angular.module('app').controller('loginCtrl', ['$http', '$scope', 'dict','$state','cache', function ($http, $scope, dict, $state, cache) {
    $scope.submit = function(){
        ajax_pos();
    }
    function ajax_pos(params) {
        $http({
            url: 'data/login.json',
            method: 'GET',
            params: params,
            //data:params
        }).then(function (res) {
            cache.put("id",res.data.id)
            cache.put("name",res.data.name)
            cache.put("image",res.data.image)
            $state.go('main');
        }, function (error) {
            console.log(error);
        });
    }
}]);

